{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "WARNING:tensorflow:From /root/anaconda3/envs/mytf/lib/python3.8/site-packages/tensorflow/python/compat/v2_compat.py:96: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "non-resource variables are not supported in the long term\n"
     ]
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import tensorflow.compat.v1 as tf\n",
    "tf.disable_v2_behavior()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "learning_rate=0.01\n",
    "training_epochs=40\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "trX=np.linspace(-1,1,101)\n",
    "num_coeffs=6\n",
    "trY_coeffs=[1,2,3,4,5,6]\n",
    "trY=0\n",
    "for i in range(num_coeffs):\n",
    "    trY += trY_coeffs[i] * np.power(trX ,i)\n",
    "trY+=np.random.randn(*trX.shape)*1.5    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAD4CAYAAADxeG0DAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/d3fzzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAa60lEQVR4nO3df4wcZ33H8c/X5mgugHJO4wTnSOoUUbcFFzucIkoqGkKDk1CIcVUFWtGgohqkRoKIWjitVKJWyC4phFYCVANRQ0UhlQgmglCTNlRRQ0GcE+dXgwk/EuGzGxuSI0G50ovz7R87G4/3Znaf2XlmZ2b3/ZJOvpudnXk8u/vdZ77PL3N3AQDaa1XdBQAAlEMgB4CWI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PnQHpL0c0mPSdqXbD9b0m2p/S5Xp5fD99VJyXS3/6Kkf5f0cPLv6ZHKlXncjHKdqs4b+rSe5/+TpPsl3Ze8WOtGVS51WsXvTX4ebMr1UidN4Mk1OZD8XF7F9cp6v0h6t6R3J7+bpI8lj9+vVI+pvPdapOs0qFyfkvRE6vrMD3pNR1Suq5Pz3qtOI+xrmnC9kr/fIenzPc+r7HqpU2k7ImlZndj1zlG+txiiDwAt1+bUCgBABHIAaD0COQC0HIEcAFqOQA4ALUcgB4CWI5ADQMv9P0EbkjqPCr+7AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(trX,trY)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "X=tf.placeholder(tf.float32)\n",
    "Y=tf.placeholder(tf.float32)\n",
    "def model(X,Y):\n",
    "    terms=[]\n",
    "    for i in range(num_coeffs):\n",
    "        term=tf.multiply(w[i],tf.pow(X,i))\n",
    "        terms.append(term)\n",
    "    return tf.add_n(terms)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "w=tf.Variable([0.]*num_coeffs,name='parameters')\n",
    "y_model=model(X,w)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "cost=(tf.pow(Y-y_model,2))\n",
    "train_op=tf.train.GradientDescentOptimizer(learning_rate).minimize(cost)\n",
    "sess=tf.Session()\n",
    "init=tf.global_variables_initializer()\n",
    "sess.run(init)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0.60943544 2.0232248  3.708029   4.843884   4.5341697  4.822623  ]\n"
     ]
    }
   ],
   "source": [
    "for epoch in range(training_epochs):\n",
    "    for(x,y)in zip(trX,trY):\n",
    "        sess.run(train_op,feed_dict={X:x,Y:y})\n",
    "w_val=sess.run(w)\n",
    "print(w_val)\n",
    "sess.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAD4CAYAAADxeG0DAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/d3fzzAAAACXBIWXMAAAsTAAALEwEAmpwYAAAqGUlEQVR4nO3deXxU9b3/8dc3IUBYQhJ2wioqvSIKNqKIrbjiclXEffdai/5c2nq9VKy29da2YGmvvUJri9VKi1p6RdG6oQUrbdVKEBSQsglYEoSwhDWBEL6/P85MmExmOZM5Z5bM+/l4zCPJmTNnvjkz85nv+Xw3Y61FRESyV166CyAiIslRIBcRyXIK5CIiWU6BXEQkyymQi4hkuTbpeNJu3brZgQMHpuOpRUSy1uLFi7dZa7uHb09LIB84cCAVFRXpeGoRkaxljNkYabtSKyIiWU6BXEQkyymQi4hkOQVyEZEsp0AuIpLl0tJrRUQk18xdUsnUeauoqqmlT3EhE8cOYdyIMk+OrUAuIuKzuUsqeeDFZdTWNwBQWVPLAy8uA/AkmCu1IiLis6nzVjUG8aDa+gamzlvlyfEVyEVEfFZVU5vQ9kQpkIuI+KxPcSF9dm/lz0/ewch/LW+y3QsK5CIiPps4dggXrK/g6B2bqO5YAkBhQT4Txw7x5PiuA7kxpp8x5h1jzEpjzApjzDcD20uNMW8bY9YEfpZ4UjIRkVZi3IgyJuxawefd+rKhtIyy4kImjx+Wll4rh4D7rLUfGWM6A4uNMW8DtwDzrbVTjDGTgEnA/Z6UTkSkNdizh56L34d77mH9lIs8P7zrGrm1drO19qPA73uAlUAZcCkwM7DbTGCcx2UUEclub78NBw/CxRf7cvgW5ciNMQO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sXj/WzXBhjTgB+A1xgrd0e3B7jNfW9XCFfuFhrXzfG/NIY083NY/0sV4hmV8Q+nq94fH1vZXNqZRFwjDFmUKD2ew3wSuC+V4CbA7/fDLip4buRyHGb5eaMfwtxxC2XMaajMaZz8HfgvJDnT9v5MsYY4ClgpbX2f8Lu8/J8xXq/hJb3pkAPg1OBXYGUkJvH+lYuY0x/4EXgRmvt6pDtsV7TVJSrV+D1wxgzEieebHfzWD/LFShPF+AMQt5zPp+vePx9b3ndeuvFDedDuwk4AGwB5gW29wFeD9nvQpxeDutwUjLB7V2B+cCawM9Sj8oV8bgRytUB5w3dJezxvweWAZ8EXqzeqSoXTqv4x4Hbikw5XzhpAhs4J0sDtwv9OF+R3i/AHcAdgd8N8IvA/csI6TEV7b3m0XmKV67fADtDzk9FvNc0ReW6O/C8H+M0wp6WCecr8PctwB/CHufb+cKptG0G6nFi19dS+d7SEH0RkSyXzakVERFBgVxEJOspkIuIZDkFchGRLKdALiKS5RTIRUSynAK5iEiW+//xgHShZDnwXAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(trX,trY)\n",
    "trY2=0\n",
    "for i in range(num_coeffs):\n",
    "    trY2 += w_val[i] * np.power(trX,i)\n",
    "plt.plot(trX,trY2,'r')\n",
    "plt.show()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
